<?php
include_once $_SERVER['DOCUMENT_ROOT'].'/lib/Validator.php';

class UserValidator extends Validator{
	protected static $_instance;

	private function __construct(){}
	private function __clone(){}
	public static function inst(){
	  if( null===self::$_instance ){
	    self::$_instance=new self();
		}
		return self::$_instance;
	}

	public function postUser($data){
	  $fld=array(
	    'u_id'=>'rgi:ur\S{32}',
	    'u_worker'=>'int',
	    'u_agency'=>'int',
	    'u_vendor'=>'int',
			'u_type'=>'ch3',
			'u_name'=>array('req','str'),
			'u_nameshort'=>array('req','str'),
			'u_email'=>array('req','eml'),
			'u_pwd'=>array('req','pwd'),
			'u_country'=>array('req','ch2','upc'),
			'u_geo'=>array('arr','rgi:ct\S{32}'),
		);
		return $this->makeCheck($data,$fld);
	}
	
	public function postProfile($data){
	  $fld=array(
			'p_key'=>array('req','rgi:ur\S{32}'),
			'p_url'=>'str',
			'p_passport'=>'str',
			'p_phone'=>array('req','int'),
			'p_bdate'=>'dte',
			'p_gender'=>'ch1',
			'p_medicalBook'=>array('req','bol'),
		);
		return $this->makeCheck($data,$fld);
	}
}
?>
